package com.hnjz.sys.user;

import java.util.Collection;
import java.util.List;

import org.springframework.security.core.GrantedAuthority;
import org.springframework.security.core.userdetails.UserDetails;

import com.hnjz.common.BaseObj;

/**
 * 用户PO
 * 
 * @author wumi
 * @version $Id: User.java, v 0.1 Jan 6, 2013 11:52:46 AM wumi Exp $
 */
public class User extends BaseObj implements UserDetails {

    /** */
    private static final long      serialVersionUID = 6039000617262742723L;

    private String                 id;

    private String                 userName;                               // 用户名称

    private String                 name;                                   // 实际名称

    private String                 passWord;                               // 密码

    public String                  isSys;

    public Integer                 version;                                // 版本号

    public String                  shoujihao;                              // 手机号

    private String                 chuanhao;

    private String                 shouji2;

    private Integer                orderBy          = 0;

    private List<GrantedAuthority> authorities;
    private String                 areaId;

    //以下为非映射字段
    private String                 role;

    public String getAreaId() {
        return areaId;
    }

    public void setAreaId(String areaId) {
        this.areaId = areaId;
    }

    public String getId() {
        return id;
    }

    public void setId(String id) {
        this.id = id;
    }

    public String getName() {
        return name;
    }

    public void setName(String name) {
        this.name = name;
    }

    public String getPassWord() {
        return passWord;
    }

    public void setPassWord(String passWord) {
        this.passWord = passWord;
    }

    public String getIsSys() {
        return isSys;
    }

    public void setIsSys(String isSys) {
        this.isSys = isSys;
    }

    public Integer getVersion() {
        return version;
    }

    public void setVersion(Integer version) {
        this.version = version;
    }

    public String getShoujihao() {
        return shoujihao;
    }

    public void setShoujihao(String shoujihao) {
        this.shoujihao = shoujihao;
    }

    public String getChuanhao() {
        return chuanhao;
    }

    public void setChuanhao(String chuanhao) {
        this.chuanhao = chuanhao;
    }

    public String getShouji2() {
        return shouji2;
    }

    public void setShouji2(String shouji2) {
        this.shouji2 = shouji2;
    }

    public Integer getOrderBy() {
        return orderBy;
    }

    public void setOrderBy(Integer orderBy) {
        this.orderBy = orderBy;
    }

    public String getRole() {
        return role;
    }

    public void setRole(String role) {
        this.role = role;
    }

    public String getUserName() {
        return userName;
    }

    public void setUserName(String userName) {
        this.userName = userName;
    }

    @Override
    public Collection<? extends GrantedAuthority> getAuthorities() {
        return this.authorities;
    }

    public void setAuthorities(List<GrantedAuthority> authorities) {
        this.authorities = authorities;
    }

    @Override
    public boolean isAccountNonExpired() {
        return true;
    }

    @Override
    public boolean isAccountNonLocked() {
        return true;
    }

    @Override
    public boolean isCredentialsNonExpired() {
        return true;
    }

    @Override
    public boolean isEnabled() {
        return true;
    }

    @Override
    public String getUsername() {
        return this.userName;
    }

    @Override
    public String getPassword() {
        return this.passWord;
    }

}
